
set(ENV{QGIS_PREFIX_PATH} "@QGIS_PYTEST_PREFIX_PATH@")
if(WIN32)
  set(ENV{PATH} "@QGIS_PYTEST_LIBRARY_PATH@;$ENV{PATH}")
  set(ENV{PYTHONPATH} "@QGIS_PYTEST_PYTHONPATH@;$ENV{PYTHONPATH}")
else()
  set(ENV{LD_LIBRARY_PATH} "@QGIS_PYTEST_LIBRARY_PATH@:$ENV{LD_LIBRARY_PATH}")
  set(ENV{PYTHONPATH} "@QGIS_PYTEST_PYTHONPATH@:$ENV{PYTHONPATH}")
endif()

@QGIS_PYTEST_ADDITIONAL_ENV_VARS@

message("export @QGIS_PYTEST_PATH_VAR_NAME@=$ENV{@QGIS_PYTEST_PATH_VAR_NAME@}")
message("export PYTHONPATH=$ENV{PYTHONPATH}")

message(STATUS "Running @PYTHON_TEST_WRAPPER_PROCESSED@ @Python_EXECUTABLE@ @QGIS_PYTEST_FILE_LOC@")
execute_process(
  COMMAND @PYTHON_TEST_WRAPPER_PROCESSED@ @Python_EXECUTABLE@ @QGIS_PYTEST_FILE_LOC@
  RESULT_VARIABLE import_res
)
# Pass the output back to ctest
if(import_res)
  message(FATAL_ERROR "Test failed: ${import_res}")
endif()
